﻿Namespace Global.Runa.UI.Threading

    Friend Class PriorityItem(Of T)

        Private _chain As PriorityChain(Of T)
        Private _data As T
        Private _priorityNext As PriorityItem(Of T)
        Private _priorityPrev As PriorityItem(Of T)
        Private _sequentialNext As PriorityItem(Of T)
        Private _sequentialPrev As PriorityItem(Of T)

        Public Sub New(ByVal data As T)
            Me._data = data
        End Sub

        Friend Property Chain As PriorityChain(Of T)
            Get
                Return Me._chain
            End Get
            Set(ByVal value As PriorityChain(Of T))
                Me._chain = value
            End Set
        End Property

        Public ReadOnly Property Data As T
            Get
                Return Me._data
            End Get
        End Property

        Public ReadOnly Property IsQueued As Boolean
            Get
                Return (Not Me._chain Is Nothing)
            End Get
        End Property

        Friend Property PriorityNext As PriorityItem(Of T)
            Get
                Return Me._priorityNext
            End Get
            Set(ByVal value As PriorityItem(Of T))
                Me._priorityNext = value
            End Set
        End Property

        Friend Property PriorityPrev As PriorityItem(Of T)
            Get
                Return Me._priorityPrev
            End Get
            Set(ByVal value As PriorityItem(Of T))
                Me._priorityPrev = value
            End Set
        End Property

        Friend Property SequentialNext As PriorityItem(Of T)
            Get
                Return Me._sequentialNext
            End Get
            Set(ByVal value As PriorityItem(Of T))
                Me._sequentialNext = value
            End Set
        End Property

        Friend Property SequentialPrev As PriorityItem(Of T)
            Get
                Return Me._sequentialPrev
            End Get
            Set(ByVal value As PriorityItem(Of T))
                Me._sequentialPrev = value
            End Set
        End Property

    End Class

End Namespace